package com.xiaoxiao.springbootstudy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoxiao.springbootstudy.pojo.Replay;
import com.xiaoxiao.springbootstudy.service.ReplayService;
import com.xiaoxiao.springbootstudy.mapper.ReplayMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* @author XiaoXiao
* @description 针对表【t_replay】的数据库操作Service实现
* @createDate 2025-05-19 08:55:58
*/
@Service
public class ReplayServiceImpl extends ServiceImpl<ReplayMapper, Replay>
    implements ReplayService{
    @Autowired
    private ReplayMapper replayMapper;

    public Map<String, Object> queryReplayListService(Integer id, Integer pageNum, Integer pageSize) {
        Page<Replay> page = new Page<>(pageNum, pageSize);
        QueryWrapper<Replay> queryWrapper = Wrappers.<Replay>query();
        queryWrapper.eq("quest_id", id);
        List<Replay> list = replayMapper.selectList(page, queryWrapper);

        Map<String, Object> map = new HashMap<>();
        map.put("list", list);
        map.put("total", page.getTotal());
        return map;
    }
}




